//
//  SetPwdViewController.m
//  ZhuKuang
//
//  Created by jayce on 17/7/11.
//  Copyright © 2017年 jjkj. All rights reserved.
//

#import "SetPwdViewController.h"
#import "ChangePwdViewController.h"

@interface SetPwdViewController ()
- (IBAction)backAction:(id)sender;
- (IBAction)changePassword:(id)sender;
- (IBAction)logoutAction:(id)sender;

@end

@implementation SetPwdViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    
    [self p_hideNavigationBar];
}

- (void)p_hideNavigationBar {
    
    self.navigationController.navigationBarHidden = YES;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)backAction:(id)sender {
    
    [self.navigationController popViewControllerAnimated:YES];
    self.navigationController.navigationBarHidden = NO;
}

- (IBAction)changePassword:(id)sender {
    
    ChangePwdViewController *change = [[ChangePwdViewController alloc]initWithNibName:@"ChangePwdViewController" bundle:nil];
    [self.navigationController pushViewController:change animated:YES];
    
}

- (IBAction)logoutAction:(id)sender {
    
    //退出登录
    [UserLoginModel setLoginOut];
    //退出程序
    [self exitApplication];
}
- (void)exitApplication {
    
    [UIView beginAnimations:@"exitApplication" context:nil];
    [UIView setAnimationDuration:0.5];
    [UIView setAnimationDelegate:self];
    [UIView setAnimationTransition:UIViewAnimationCurveEaseOut forView:self.view cache:NO];
    [UIView setAnimationDidStopSelector:@selector(animationFinished:finished:context:)];
    self.view.bounds = CGRectMake(0, 0, 0, 0);
    [UIView commitAnimations];
}

- (void)animationFinished:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context {

    if ([animationID compare:@"exitApplication"] == 0) {
    
        exit(0);
    
    }
}
@end
